package miracle.joker.design.observer;

public class ObserverDemo {
    public static void main(String[] args) {
        // 创建WeatherData对象
        WeatherData weatherData = new WeatherData();

        // 创建具体的观察者对象并注册到WeatherData对象中
        CurrentConditionsDisplay currentDisplay = new CurrentConditionsDisplay(weatherData);
        StatisticsDisplay statisticsDisplay = new StatisticsDisplay(weatherData);
        ForecastDisplay forecastDisplay = new ForecastDisplay(weatherData);

        // 模拟气象数据变化
        weatherData.setMeasurements(80, 65, 30.4f);
        weatherData.setMeasurements(82, 70, 29.2f);
        weatherData.setMeasurements(78, 90, 29.2f);
    }
}
